# -*- coding: utf-8 -*-
import cv2 as cv
import time
from mediapipe.python.solutions import drawing_utils, pose


cap = cv.VideoCapture("videos/pose1.mp4")

mpPose = pose.Pose(min_detection_confidence=0.8, min_tracking_confidence=0.5)
mpDrawspec = drawing_utils.DrawingSpec(thickness=1, circle_radius=1)

while True:
    flag, frame = cap.read()

    frameRGB = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
    results = mpPose.process(frameRGB)

    if not results.pose_landmarks:
        continue
    
    # drawing_utils.draw_landmarks(frame, results.pose_landmarks, pose.POSE_CONNECTIONS)
    drawing_utils.draw_landmarks(frame, results.pose_landmarks, pose.POSE_CONNECTIONS, mpDrawspec, mpDrawspec)

    cv.imshow("video", frame)

    if cv.waitKey(10) & 0xFF == ord('q'):
        break

cap.release()
cv.destroyAllWindows()